package org.indt.scrum.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.indt.scrum.dao.ProjectAllocationDAO;
import org.indt.scrum.model.Projectallocation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;


public class ProjectAllocationDAOImpl implements ProjectAllocationDAO{
	
	private HibernateTemplate hibernateTemplate;

	@Autowired
	public ProjectAllocationDAOImpl(SessionFactory sessionFactory) {
		this.hibernateTemplate = new HibernateTemplate(sessionFactory);
	}
	
	@Override
	public void delete(Projectallocation entity) {
		this.hibernateTemplate.delete(entity);	
		
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Projectallocation> listAll() {
		return this.hibernateTemplate.find("from Projectallocation");
	}
	@Override
	public Projectallocation load(Integer id) {
		return (Projectallocation) this.hibernateTemplate.load(Projectallocation.class, id);
	}
	@Override
	public void save(Projectallocation entity) {
		this.hibernateTemplate.save(entity);
		
	}
	@Override
	public void update(Projectallocation entity) {
		this.hibernateTemplate.update(entity);
		
	}


}
